<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class cabang extends CI_Controller {
	  var $data = array();

	  public function __construct() {
        parent::__construct();
        if (!$this->session->userdata('username')) {
            redirect('login');
            return;
        }
        $this->data['sidebarhome']="";
	    $this->data['sidebardaftar']="";
	    $this->data['sidebardaftarclient']="";
	    $this->data['sidebardaftarfinance']="";
    	$this->data['sidebarinputdata']="";
    	
    	$this->data['sidebarcustomer']="";
    	$this->data['sidebarcabang']="";
    	$this->data['sidebaruser']="";
    	
    	$this->load->model('mkaryawan');

       }

    public function index() {
       $this->data['sidebarcabang']="active";
       $this->data['querycabang'] = $this->mkaryawan->fgetallkota();
       $this->load->view('vlistcabang',$this->data);
    }

    public function tambahcabang() {
       $this->data['queryprovinsi'] = $this->mkaryawan->fgetallprovinsi();
       $this->load->view('vtambahcabang',$this->data);    	
    }

    public function Ftambahcabang() {
        $data123 = array(
			'id_provinsi' => $this->input->post('provinsi'),   
			'nama_kota' => $this->input->post('nama_cabang'),            
			'keterangan' => $this->input->post('keterangan'),            
		);
		$this->mkaryawan->mtambahcabang($data123);
        redirect('cabang/tambahcabang/y');    
    }

}
